package designPattern;


interface Person{
    public void run();
}

class libofei implements Person{
    public void run() {
        System.out.println("李博飞");
    }
}
class chenzhenjia implements  Person{
    public void  run() {
        System.out.println("陈贞佳");
    }
}
class Factory{
    public  static  Person getPersonByName(int type){
        Person person = null;
        switch (type){
            case 1 :
                person = new libofei();
                break;
            case 2 :
                person = new chenzhenjia();
                break;
        }
        return person;
    }
}
/**
 *工厂设计模式
 * **/
public class FactoryPattern {
    public static void main(String[] args) {
        Person person = Factory.getPersonByName(2);
        person.run();
    }
}
